﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace Poke_Tactics.Cenas.Story
{
    class Intro_2
    {
        GameWindow Window;
        Texture2D image;
        Button next;

        protected float alfa;

        public float Alfa
        {
            get { return alfa; }

            set
            {

                if (value >= 0 && value <= 1)
                {
                    alfa = value;
                }
                else
                {
                    alfa = 0;
                }

            }

        }


        float scale = 0.5f;

        public Intro_2(GameWindow Window, Texture2D image, Texture2D button)
        {
            this.Window = Window;
            this.image = image;
            this.next = new Button(Window, button);
            next.position = new Vector2(690, 410);
            this.alfa = 1;
        }

        public void Update(GameTime gameTime, MouseState mouse, MouseState old_mouse)
        {

            next.Update(gameTime, new Vector2(mouse.X, mouse.Y), mouse, old_mouse);

            if (gameTime.TotalGameTime.Milliseconds % 100 == 0)
            {
                Alfa -= 0.02f;
            }

            if (next.isClicked || Alfa <= 0.0f)
            {
                Game1.cena_atual = Game1.cenas.CENA_MAINGAME;
                next.isClicked = false;
                Game1.cameraAtual.position = new Vector2(436, 800);
            }
        }


        public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {


            spriteBatch.Draw(image, new Vector2(185, 0), new Rectangle(0, 0, (int)(image.Width * 1), (int)(image.Height * 1)), new Color(1.0f * alfa, 1.0f * alfa, 1.0f * alfa, 1.0f * alfa), 0, new Vector2(), scale, SpriteEffects.None, 0);

            next.Draw(gameTime, spriteBatch);


        }


    }
}
